// router/index.js
const { log } = require('console')
const express = require('express')
const fs = require('fs')
const path = require('path')

const router = express.Router()

// 自动加载 router 目录下的所有路由文件
fs.readdirSync(__dirname).forEach((file) => {
  if (file !== 'index.js') {
    const route = require(path.join(__dirname, file))
    router.use(route)
  }
})

module.exports = router
